package com.jack.leetcode.每日一题;

import java.util.Arrays;

/***
 * @author zhangjie
 * @date 2020/4/28 19:52
 */
public class 数组中数字出现的次数 {

    public int[] singleNumbers(int[] nums) {
        Arrays.sort(nums);
        int[] result = new int[2];
        result[1] = nums[nums.length-1];
        int index = 0;
        for(int i = 0;i<nums.length-1;i++){
            if(nums[i] == nums[i+1]){
                i++;
            }else{
                result[index++] = nums[i];
            }
        }
        return result;
    }
}
